<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="robots" content="index,nofollow">

<title>UbuntuBootupHowto - Community Ubuntu Documentation</title>
<script type="text/javascript" src="/moin_static192/common/js/common.js"></script>

<script type="text/javascript">
<!--
var search_hint = "Search";
//-->
</script>


<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/moin_static192/ubuntunew/css/common.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="/moin_static192/ubuntunew/css/screen.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="print" href="/moin_static192/ubuntunew/css/print.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="projection" href="/moin_static192/ubuntunew/css/projection.css">

<!-- css only for MS IE6/IE7 browsers -->
<!--[if lt IE 8]>
   <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/moin_static192/ubuntunew/css/msie.css">
<![endif]-->





<link rel="Start" href="/community/UserDocumentation">
<link rel="Alternate" title="Wiki Markup" href="/community/UbuntuBootupHowto?action=raw">
<link rel="Alternate" media="print" title="Print View" href="/community/UbuntuBootupHowto?action=print">
<link rel="Search" href="/community/FindPage">
<link rel="Index" href="/community/TitleIndex">
<link rel="Glossary" href="/community/WordIndex">
<link rel="Help" href="/community/HelpOnFormatting">
</head>

<body  lang="en" dir="ltr">

<div id="round" class="roundme">
<img id="topcap" alt="" src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-top.png">
<div id="layout" class="container clear-block">
<div id="header">
<div id="logo-floater">
<h1><a href="http://help.ubuntu.com" title="Ubuntu Documentation"><img alt="Ubuntu" id="logo" src="https://help.ubuntu.com/htdocs/ubuntunew/img/logo.png" /></a></h1>
</div>

<noscript>
 <form action="http://www.google.com/cse" id="cse-search-box">
   <div>
     <input type="hidden" name="cx" value="004599128559784038176:vj_p0xo-nng" />
     <input type="hidden" name="ie" value="UTF-8" />
     <input type="text" name="q" size="27" />
     <input type="submit" name="sa" value="Search" />
   </div>
 </form>
</noscript>

<script>
 document.write('<form action="https://help.ubuntu.com/search.html" id="cse-search-box">');
 document.write('  <div>');
 document.write('    <input type="hidden" name="cof" value="FORID:9" />');
 document.write('    <input type="hidden" name="cx" value="004599128559784038176:vj_p0xo-nng" />');
 document.write('    <input type="hidden" name="ie" value="UTF-8" />');
 document.write('    <input type="text" name="q" size="27" />');
 document.write('    <input type="submit" name="sa" value="Search" />');
 document.write('  </div>');
 document.write('</form>');
</script>

<div id="sitename"><a href="https://help.ubuntu.com/community"><img src="https://help.ubuntu.com/htdocs/ubuntunew/img/help-faq.png" /><span>Community Documentation</span></a></div>
</div> <!--header-->
<ul id="loginbar"><li><a href="/community/UbuntuBootupHowto?action=login" id="login" rel="nofollow">Login to Edit</a></li></ul>


<!--1-->
<div id="page" lang="en" dir="ltr">

<!--2-->

<div id="breadcrumbs">
<a href="https://help.ubuntu.com/">Ubuntu Documentation</a> &gt; <a href="https://help.ubuntu.com/community">Community Documentation</a> &gt; <a class="backlink" href="/community/UbuntuBootupHowto?action=fullsearch&amp;context=180&amp;value=linkto%3A%22UbuntuBootupHowto%22" rel="nofollow" title="Click to do a full-text search for this title">UbuntuBootupHowto</a>
</div>


<ul id="pagelocation">
<li><a class="backlink" href="/community/UbuntuBootupHowto?action=fullsearch&amp;context=180&amp;value=linkto%3A%22UbuntuBootupHowto%22" rel="nofollow" title="Click to do a full-text search for this title">UbuntuBootupHowto</a></li>
</ul>

<!--3--><div dir="ltr" id="content" lang="en"><span class="anchor" id="top"></span>
<span class="anchor" id="line-1"></span><p class="line867"><div dir="ltr" id="Tag.2BAC8-StyleCleanup.content" lang="en"><span class="anchor" id="Tag.2BAC8-StyleCleanup.top"></span>
<span class="anchor" id="Tag.2BAC8-StyleCleanup.line-1"></span><div><table style="border: 2px black solid;  background: #AFE2A0;  width: 80%;  margin-left: 10%;  margin-right: 10%;  float: center;  text-align:center;"><tbody><tr>  <td><p class="line862"> <strong>Style Cleanup Required:</strong> This article does not follow the style standards in the Wiki Guide. <a href="/community/Tag#StyleCleanup">More info...</a> </td>
</tr>
</tbody></table></div><span class="anchor" id="Tag.2BAC8-StyleCleanup.line-2"></span><span class="anchor" id="Tag.2BAC8-StyleCleanup.bottom"></span></div> <span class="anchor" id="line-2"></span><div dir="ltr" id="Tag.2BAC8-ContentCleanup.content" lang="en"><span class="anchor" id="Tag.2BAC8-ContentCleanup.top"></span>
<span class="anchor" id="Tag.2BAC8-ContentCleanup.line-1"></span><div><table style="border: 2px black solid;  background: #A0B8E2;  width: 80%;  margin-left: 10%;  margin-right: 10%;  float: center;  text-align:center;"><tbody><tr>  <td><p class="line862"> <strong>Content Cleanup Required:</strong> This article should be cleaned-up to follow the content standards in the Wiki Guide. <a href="/community/Tag#ContentCleanup">More info...</a> </td>
</tr>
</tbody></table></div><span class="anchor" id="Tag.2BAC8-ContentCleanup.line-2"></span><span class="anchor" id="Tag.2BAC8-ContentCleanup.bottom"></span></div> <span class="anchor" id="line-3"></span><span class="anchor" id="line-4"></span><p class="line867"><span class="anchor" id="line-5"></span><p class="line867"><span class="anchor" id="line-6"></span><p class="line867"><span class="anchor" id="line-7"></span><span class="anchor" id="line-8"></span><div><table style="float:right;  font-size: 0.9em;  width:40%;  background:#F1F1ED;  margin: 0 0 1em 1em;"><tbody><tr>  <td style="padding:0.5em;"><p class="line891"><div class="table-of-contents"><p class="table-of-contents-heading">Contents<ol><li>
<a href="#Since_Ubuntu_6.10_.28Edgy_Eft.29">Since Ubuntu 6.10 (Edgy Eft)</a><ol><li>
<a href="#Directories_and_Configs">Directories and Configs</a></li><li>
<a href="#Using_Services">Using Services</a></li><li>
<a href="#Other_Upstart_Commands">Other Upstart Commands</a></li><li>
<a href="#Writing_Services">Writing Services</a></li></ol></li><li>
<a href="#Traditional_Sysvinit_and_Before_Ubuntu_6.10">Traditional Sysvinit and Before Ubuntu 6.10</a><ol><li>
<a href="#Init_scripts">Init scripts</a></li><li>
<a href="#Deactivating_init-scripts">Deactivating init-scripts</a></li><li>
<a href="#Installing_custom_init-scripts">Installing custom init-scripts</a></li><li>
<a href="#List_of_init_scripts">List of init scripts</a></li><li>
<a href="#Links">Links</a></li><li>
<a href="#Useful_Comments">Useful Comments</a></li></ol></li></ol></div></td>
</tr>
</tbody></table></div><span class="anchor" id="line-9"></span><span class="anchor" id="line-10"></span><p class="line867">
<h1 id="Since_Ubuntu_6.10_.28Edgy_Eft.29">Since Ubuntu 6.10 (Edgy Eft)</h1>
<span class="anchor" id="line-11"></span><span class="anchor" id="line-12"></span><p class="line874">Since the introduction of Upstart some time in 2006, or more relevantly 9.10 Karmic where most of the system services were converted, the boot process changed somewhat. The following information is tested on 11.04 Natty: <span class="anchor" id="line-13"></span><span class="anchor" id="line-14"></span><p class="line867">
<h2 id="Directories_and_Configs">Directories and Configs</h2>
<span class="anchor" id="line-15"></span><span class="anchor" id="line-16"></span><ul><li><p class="line891"><strong>/etc/init</strong> is where the upstart init configs live. While they are not scripts themselves, they essentially execute whatever is required to replace sysvinit scripts. <span class="anchor" id="line-17"></span></li><li><p class="line891"><strong>/etc/init.d</strong> is where all the traditional sysvinit scripts and the backward compatible scripts for upstart live. The backward compatible scripts basically run <strong>service myservice start</strong> instead of doing anything themselves. Some just show a notice to use the "service" command. <span class="anchor" id="line-18"></span></li><li><p class="line891"><strong>/etc/init/rc-sysinit.conf</strong> controls execution of traditional scripts added manually or with <strong>update-rc.d</strong> to traditional runlevels in /etc/rc* <span class="anchor" id="line-19"></span></li><li><p class="line891"><strong>/etc/default</strong> has configuration files allowing you to control the behaviour of both traditional sysvinit scripts and new upstart configs. <span class="anchor" id="line-20"></span><span class="anchor" id="line-21"></span></li></ul><p class="line867">
<h2 id="Using_Services">Using Services</h2>
<span class="anchor" id="line-22"></span><span class="anchor" id="line-23"></span><p class="line874">Please note that generally, you can use either traditional sysvinit scripts and the methods of working with them as well as the new upstart configs and the command: "service" interchangeably. It is however recommended you use the new upstart methods which are both forward and backward compatible. <span class="anchor" id="line-24"></span><span class="anchor" id="line-25"></span><p class="line867"><strong>Starting a Service</strong> <span class="anchor" id="line-26"></span><span class="anchor" id="line-27"></span><p class="line867"><span class="anchor" id="line-28"></span><span class="anchor" id="line-29"></span><span class="anchor" id="line-30"></span><span class="anchor" id="line-31"></span><span class="anchor" id="line-32"></span><pre><span class="anchor" id="line-1"></span># Traditional:
<span class="anchor" id="line-2"></span>/etc/init.d/myservice start
<span class="anchor" id="line-3"></span># Upstart
<span class="anchor" id="line-4"></span>service myservice start</pre><span class="anchor" id="line-33"></span><span class="anchor" id="line-34"></span><p class="line867"><strong>Stopping a Service</strong> <span class="anchor" id="line-35"></span><span class="anchor" id="line-36"></span><p class="line867"><span class="anchor" id="line-37"></span><span class="anchor" id="line-38"></span><span class="anchor" id="line-39"></span><span class="anchor" id="line-40"></span><span class="anchor" id="line-41"></span><pre><span class="anchor" id="line-1-1"></span># Traditional:
<span class="anchor" id="line-2-1"></span>/etc/init.d/myservice stop
<span class="anchor" id="line-3-1"></span># Upstart
<span class="anchor" id="line-4-1"></span>service myservice stop</pre><span class="anchor" id="line-42"></span><span class="anchor" id="line-43"></span><p class="line867"><strong>Getting a list of Services</strong> <span class="anchor" id="line-44"></span><span class="anchor" id="line-45"></span><p class="line867"><span class="anchor" id="line-46"></span><span class="anchor" id="line-47"></span><span class="anchor" id="line-48"></span><span class="anchor" id="line-49"></span><span class="anchor" id="line-50"></span><pre><span class="anchor" id="line-1-2"></span># Traditional:
<span class="anchor" id="line-2-2"></span>ls /etc/init.d
<span class="anchor" id="line-3-2"></span># Upstart:
<span class="anchor" id="line-4-2"></span>service --status-all</pre><span class="anchor" id="line-51"></span><ul><li><p class="line891"><strong>Note:</strong> Upstart method will show both traditional and upstart services. <span class="anchor" id="line-52"></span><span class="anchor" id="line-53"></span></li></ul><p class="line867"><strong>Adding a Service to Default runlevels</strong> <span class="anchor" id="line-54"></span><span class="anchor" id="line-55"></span><p class="line867"><span class="anchor" id="line-56"></span><span class="anchor" id="line-57"></span><span class="anchor" id="line-58"></span><pre><span class="anchor" id="line-1-3"></span># Traditional
<span class="anchor" id="line-2-3"></span>update-rc.d apache2 defaults</pre><span class="anchor" id="line-59"></span><span class="anchor" id="line-60"></span><ul><li><p class="line891"><strong>Upstart</strong>: there is no concept of runlevels, everything is event driven with dependencies. You would add an upstart config to <strong>/etc/init</strong> and potentially source a config file in <strong>/etc/default</strong> to allow users to override default behaviour. <span class="anchor" id="line-61"></span><span class="anchor" id="line-62"></span></li></ul><p class="line867"><strong>Removing a Service from Default runlevels</strong> <span class="anchor" id="line-63"></span><span class="anchor" id="line-64"></span><p class="line867"><span class="anchor" id="line-65"></span><span class="anchor" id="line-66"></span><span class="anchor" id="line-67"></span><pre><span class="anchor" id="line-1-4"></span># Traditional - Something along the lines of
<span class="anchor" id="line-2-4"></span>rm /etc/rc*/*myscript</pre><span class="anchor" id="line-68"></span><span class="anchor" id="line-69"></span><ul><li><p class="line891"><strong>Upstart</strong>: If no config is available in /etc/default, edit config in /etc/init <span class="anchor" id="line-70"></span><span class="anchor" id="line-71"></span></li></ul><p class="line867">
<h2 id="Other_Upstart_Commands">Other Upstart Commands</h2>
<span class="anchor" id="line-72"></span><span class="anchor" id="line-73"></span><p class="line867"><strong>Controlling Services - interchangeable with the "service" command</strong> <span class="anchor" id="line-74"></span><ul><li><p class="line891"><strong>initctl</strong> - can use in place of "service" with the commands bellow. Run initctl help. <span class="anchor" id="line-75"></span></li><li><p class="line891"><strong>start</strong> - start a service <span class="anchor" id="line-76"></span></li><li><p class="line891"><strong>stop</strong> - stop a service <span class="anchor" id="line-77"></span></li><li><p class="line891"><strong>reload</strong> - sends a SIGHUP signal to running process <span class="anchor" id="line-78"></span></li><li><p class="line891"><strong>restart</strong> - restarts a service without reloading its job config file <span class="anchor" id="line-79"></span></li><li><p class="line891"><strong>status</strong> - requests status of service <span class="anchor" id="line-80"></span><span class="anchor" id="line-81"></span></li></ul><p class="line867"><strong>Rebooting and Powering off the system</strong> <span class="anchor" id="line-82"></span><ul><li><p class="line891"><strong>halt</strong> - shutdown the system then power off <span class="anchor" id="line-83"></span></li><li><p class="line891"><strong>poweroff</strong> - shutdown the system then power off <span class="anchor" id="line-84"></span></li><li><p class="line891"><strong>reboot</strong> - reboot the system <span class="anchor" id="line-85"></span></li><li><p class="line891"><strong>shutdown</strong> - bring the system down <span class="anchor" id="line-86"></span><span class="anchor" id="line-87"></span></li></ul><p class="line867"><strong>Misc Upstart Commands</strong> - you generally don't use these directly <span class="anchor" id="line-88"></span><ul><li><p class="line891"><strong>init</strong> - Upstart process management daemon  <span class="anchor" id="line-89"></span></li><li><p class="line891"><strong>runlevel</strong> - Backward compatibility with traditional runlevels <span class="anchor" id="line-90"></span></li><li><p class="line891"><strong>telinit</strong> - Backward compatibility with traditional runlevels <span class="anchor" id="line-91"></span></li><li><p class="line891"><strong>upstart-udev-bridge</strong> - Bridge between upstart and udev <span class="anchor" id="line-92"></span><span class="anchor" id="line-93"></span></li></ul><p class="line867">
<h2 id="Writing_Services">Writing Services</h2>
<span class="anchor" id="line-94"></span><span class="anchor" id="line-95"></span><p class="line862">The most current reference for job/service definition is available in the man page for init, available by running <a class="http" href="http://manpages.ubuntu.com/manpages/natty/en/man5/init.5.html">man 5 init</a>. There are also some very useful pointers in <a class="http" href="http://upstart.ubuntu.com/cookbook/">The Upstart Cookbook</a>. <span class="anchor" id="line-96"></span><span class="anchor" id="line-97"></span><p class="line862">Here is an example of a simple upstart job config: <strong>/etc/init/myservice.conf</strong> <span class="anchor" id="line-98"></span><span class="anchor" id="line-99"></span><p class="line867"><span class="anchor" id="line-100"></span><span class="anchor" id="line-101"></span><span class="anchor" id="line-102"></span><span class="anchor" id="line-103"></span><span class="anchor" id="line-104"></span><span class="anchor" id="line-105"></span><span class="anchor" id="line-106"></span><span class="anchor" id="line-107"></span><span class="anchor" id="line-108"></span><span class="anchor" id="line-109"></span><span class="anchor" id="line-110"></span><span class="anchor" id="line-111"></span><span class="anchor" id="line-112"></span><span class="anchor" id="line-113"></span><span class="anchor" id="line-114"></span><span class="anchor" id="line-115"></span><span class="anchor" id="line-116"></span><span class="anchor" id="line-117"></span><span class="anchor" id="line-118"></span><span class="anchor" id="line-119"></span><span class="anchor" id="line-120"></span><span class="anchor" id="line-121"></span><span class="anchor" id="line-122"></span><span class="anchor" id="line-123"></span><span class="anchor" id="line-124"></span><span class="anchor" id="line-125"></span><span class="anchor" id="line-126"></span><span class="anchor" id="line-127"></span><span class="anchor" id="line-128"></span><span class="anchor" id="line-129"></span><span class="anchor" id="line-130"></span><pre><span class="anchor" id="line-1-5"></span># myservice - myservice job file
<span class="anchor" id="line-2-5"></span>
<span class="anchor" id="line-3-3"></span>description "my service description"
<span class="anchor" id="line-4-3"></span>author "Me &lt;myself@i.com&gt;"
<span class="anchor" id="line-5"></span>
<span class="anchor" id="line-6"></span># Stanzas
<span class="anchor" id="line-7"></span>#
<span class="anchor" id="line-8"></span># Stanzas control when and how a process is started and stopped
<span class="anchor" id="line-9"></span># See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn
<span class="anchor" id="line-10"></span>
<span class="anchor" id="line-11"></span># When to start the service
<span class="anchor" id="line-12"></span>start on runlevel [2345]
<span class="anchor" id="line-13"></span>
<span class="anchor" id="line-14"></span># When to stop the service
<span class="anchor" id="line-15"></span>stop on runlevel [016]
<span class="anchor" id="line-16"></span>
<span class="anchor" id="line-17"></span># Automatically restart process if crashed
<span class="anchor" id="line-18"></span>respawn
<span class="anchor" id="line-19"></span>
<span class="anchor" id="line-20"></span># Essentially lets upstart know the process will detach itself to the background
<span class="anchor" id="line-21"></span>expect fork
<span class="anchor" id="line-22"></span>
<span class="anchor" id="line-23"></span># Run before process
<span class="anchor" id="line-24"></span>pre-start script
<span class="anchor" id="line-25"></span>    [ -d /var/run/myservice ] || mkdir -p /var/run/myservice
<span class="anchor" id="line-26"></span>    echo "Put bash code here"
<span class="anchor" id="line-27"></span>end script
<span class="anchor" id="line-28"></span>
<span class="anchor" id="line-29"></span># Start the process
<span class="anchor" id="line-30"></span>exec myprocess</pre><span class="anchor" id="line-131"></span><span class="anchor" id="line-132"></span><p class="line867">
<h3 id="Helpful_Tips">Helpful Tips</h3>
<span class="anchor" id="line-133"></span><span class="anchor" id="line-134"></span><ol type="1"><li><p class="line891"><strong>initctl list</strong> shows new services straight away, service command might not! <span class="anchor" id="line-135"></span></li><li><p class="line862">Check <strong>/var/log/syslog</strong>, it will show clues as to what went wrong. <span class="anchor" id="line-136"></span></li><li>All scripts default to running with errexit (set -e), so any non-zero exit status will cause errors. In pre-start, this means the service won't start. <span class="anchor" id="line-137"></span></li><li>if you want to fire events from your legacy sysvinit scripts, for example postgres, you can add the following: <span class="anchor" id="line-138"></span><ul><li>'initctl emit starting-postgresql’ in /etc/init.d/postgresql just before the service is started <span class="anchor" id="line-139"></span></li><li>‘initctl emit started-postgresql’ just after <span class="anchor" id="line-140"></span></li><li>As well as ‘initctl emit stopping-postgresql’ and ‘initctl emit stopped-postgresql <span class="anchor" id="line-141"></span></li><li>Then you can use ‘start on started-postgresql’ and ‘stop on stopping-postgresql’ in your job. <span class="anchor" id="line-142"></span><span class="anchor" id="line-143"></span></li></ul></li></ol><p class="line862">See <a class="http" href="http://upstart.ubuntu.com/getting-started.html">Upstart Getting Started</a> for more details about upstart. <span class="anchor" id="line-144"></span><span class="anchor" id="line-145"></span><p class="line862">[For more details about Ubuntu transitioning away from the sysv init system. See <a class="http" href="http://www.linux.com/feature/125977?theme=print">upstart</a>.] <span class="anchor" id="line-146"></span><span class="anchor" id="line-147"></span><p class="line867">
<h1 id="Traditional_Sysvinit_and_Before_Ubuntu_6.10">Traditional Sysvinit and Before Ubuntu 6.10</h1>
<span class="anchor" id="line-148"></span><span class="anchor" id="line-149"></span><p class="line867">
<h2 id="Init_scripts">Init scripts</h2>
<span class="anchor" id="line-150"></span><span class="anchor" id="line-151"></span><p class="line867"><img alt="IconsPage/IconBoot.png" class="attachment" src="/community/IconsPage?action=AttachFile&amp;do=get&amp;target=IconBoot.png" title="IconsPage/IconBoot.png" /> <span class="anchor" id="line-152"></span><span class="anchor" id="line-153"></span><p class="line874">Init scripts are the scripts located in /etc/init.d. These scripts are  <span class="anchor" id="line-154"></span>part of the bootup sequence of Ubuntu. During boot, they are not called <span class="anchor" id="line-155"></span>directly, but through a structure of symbolic links which manage the  <span class="anchor" id="line-156"></span>services which are to be started in a particular <strong>runlevel</strong>. The scripts <span class="anchor" id="line-157"></span>which are symlinked from /etc/rcS.d are executed first. Then the scripts in <span class="anchor" id="line-158"></span>/etc/rcN.d/ are executed, with <em>N</em> being the chosen runlevel (default 2). <span class="anchor" id="line-159"></span><span class="anchor" id="line-160"></span><p class="line874">The LSB specifies some scripts that are used for displaying the output of the initscripts. To change how the init script's startup is displayed look in to /lib/lsb/init-functions <span class="anchor" id="line-161"></span><span class="anchor" id="line-162"></span><p class="line867">
<h2 id="Deactivating_init-scripts">Deactivating init-scripts</h2>
<span class="anchor" id="line-163"></span><span class="anchor" id="line-164"></span><p class="line867">
<h3 id="Method:_Deleting_the_rc.2A.d_links">Method: Deleting the rc*.d links</h3>
<span class="anchor" id="line-165"></span><span class="anchor" id="line-166"></span><p class="line874">To deactivate a script (meaning that it will not be executed at <span class="anchor" id="line-167"></span>bootup), remove the corresponding symlink from /etc/rc?.d. Do <strong>not</strong> <span class="anchor" id="line-168"></span>use the <strong>update-rc.d</strong> command for this purpose! It is only used in <span class="anchor" id="line-169"></span>package installation scripts, and not designed for this kind of <span class="anchor" id="line-170"></span>runlevel management. <span class="anchor" id="line-171"></span><span class="anchor" id="line-172"></span><p class="line874">Some people on the mailinglist complained on boot-delays because of the  <span class="anchor" id="line-173"></span>NTP-Server sync. To remove this issue the following command: <span class="anchor" id="line-174"></span><span class="anchor" id="line-175"></span><span class="anchor" id="line-176"></span><pre><span class="anchor" id="line-1-6"></span>    sudo rm /etc/rcS.d/S51ntpdate</pre><span class="anchor" id="line-177"></span><ul><li>Problem: <span class="anchor" id="line-178"></span><ul><li>To restore the links with the right S?? or K?? values you have to look up those values on another system or take a look at the deb-Package install scripts ... <span class="anchor" id="line-179"></span><span class="anchor" id="line-180"></span></li></ul></li></ul><p class="line867">
<h3 id="Method:_Use_chmod_to_deactivate_a_service">Method: Use chmod to deactivate a service</h3>
<span class="anchor" id="line-181"></span><span class="anchor" id="line-182"></span><p class="line874">A more straightforward way is to make the init script non-executable.  You do that with the *chmod* command. <span class="anchor" id="line-183"></span><span class="anchor" id="line-184"></span><span class="anchor" id="line-185"></span><pre><span class="anchor" id="line-1-7"></span>    sudo chmod -x /etc/init.d/myscript</pre><span class="anchor" id="line-186"></span><p class="line874">After this the service will no longer be able to run. <span class="anchor" id="line-187"></span><span class="anchor" id="line-188"></span><p class="line874">Reactivate the service with: <span class="anchor" id="line-189"></span><span class="anchor" id="line-190"></span><span class="anchor" id="line-191"></span><pre><span class="anchor" id="line-1-8"></span>    sudo chmod +x /etc/init.d/myscript</pre><span class="anchor" id="line-192"></span><ul><li>Problem <span class="anchor" id="line-193"></span><ul><li><p class="line862">Now you'll get an error message at boot time saying that init can't execute <tt>/etc/init.d/myscript</tt>. <span class="anchor" id="line-194"></span></li></ul></li><li>Solution <span class="anchor" id="line-195"></span><ul><li><p class="line862">To avoid this error msgs you have to modify the <tt>/etc/init.d/rc</tt> and the <tt>/etc/init.d/</tt> scripts a bit. To do this simply download and apply the following diffs. <span class="anchor" id="line-196"></span></li></ul></li></ul><p class="line867"><span class="anchor" id="line-197"></span><span class="anchor" id="line-198"></span><span class="anchor" id="line-199"></span><span class="anchor" id="line-200"></span><span class="anchor" id="line-201"></span><span class="anchor" id="line-202"></span><span class="anchor" id="line-203"></span><span class="anchor" id="line-204"></span><pre><span class="anchor" id="line-1-9"></span>    cd /tmp
<span class="anchor" id="line-2-6"></span>    wget http://www.ubuntulinux.org/wiki/rc.diff
<span class="anchor" id="line-3-4"></span>    wget http://www.ubuntulinux.org/wiki/rcS.diff
<span class="anchor" id="line-4-4"></span>
<span class="anchor" id="line-5-1"></span>    cd /etc/init.d
<span class="anchor" id="line-6-1"></span>    sudo patch -p3 &lt; /tmp/rc.diff
<span class="anchor" id="line-7-1"></span>    sudo patch -p3 &lt; /tmp/rcS.diff</pre><span class="anchor" id="line-205"></span><span class="anchor" id="line-206"></span><p class="line867">
<h3 id="Method:_Use_sysvconfig_to_deactivate_a_service">Method: Use sysvconfig to deactivate a service</h3>
<span class="anchor" id="line-207"></span><span class="anchor" id="line-208"></span><p class="line862">The <a href="/community/SysvconfigHowTo">SysvconfigHowTo</a> explains the installation and use of the sysvconfig utility. <span class="anchor" id="line-209"></span><span class="anchor" id="line-210"></span><p class="line867">
<h2 id="Installing_custom_init-scripts">Installing custom init-scripts</h2>
<span class="anchor" id="line-211"></span><span class="anchor" id="line-212"></span><p class="line874">To install your own script, copy it to /etc/init.d, and make it executable. <span class="anchor" id="line-213"></span><span class="anchor" id="line-214"></span><span class="anchor" id="line-215"></span><span class="anchor" id="line-216"></span><pre><span class="anchor" id="line-1-10"></span>    sudo cp myscript /etc/init.d
<span class="anchor" id="line-2-7"></span>    sudo chmod +x /etc/init.d/myscript</pre><span class="anchor" id="line-217"></span><p class="line862">To make the script run with the <em>start</em> argument at the end of the start sequence, and run with the <em>stop</em> argument at the beginning of the shutdown sequence: <span class="anchor" id="line-218"></span><span class="anchor" id="line-219"></span><span class="anchor" id="line-220"></span><pre><span class="anchor" id="line-1-11"></span>    sudo update-rc.d myscript defaults 98 02</pre><span class="anchor" id="line-221"></span><p class="line874">98 and 02 are the start and stop sequence numbers respectively. Both are numbers between 00 and 99 and specify how early or late a service is started or killed. If a service is started late, it should be killed early and vice-versa. A good rule of thumb is to make the stop sequence number equal to 100 minus the start sequence number. <span class="anchor" id="line-222"></span><span class="anchor" id="line-223"></span><p class="line874">For more information on the usage of update-rc.d <span class="anchor" id="line-224"></span><span class="anchor" id="line-225"></span><span class="anchor" id="line-226"></span><pre><span class="anchor" id="line-1-12"></span>    man update-rc.d</pre><span class="anchor" id="line-227"></span><p class="line867"><img alt="IconsPage/IconWarning3.png" class="attachment" src="/community/IconsPage?action=AttachFile&amp;do=get&amp;target=IconWarning3.png" title="IconsPage/IconWarning3.png" /> <span class="anchor" id="line-228"></span><span class="anchor" id="line-229"></span><p class="line867">
<h2 id="List_of_init_scripts">List of init scripts</h2>
<span class="anchor" id="line-230"></span><p class="line862">see <a href="/community/InitScriptList">InitScriptList</a> <span class="anchor" id="line-231"></span><span class="anchor" id="line-232"></span><p class="line867">
<h2 id="Links">Links</h2>
<span class="anchor" id="line-233"></span><span class="anchor" id="line-234"></span><ul><li><p class="line891"><a class="http" href="http://www.wlug.org.nz/update-rc.d%288%29">http://www.wlug.org.nz/update-rc.d%288%29</a> <span class="anchor" id="line-235"></span></li><li><p class="line891"><a class="http" href="http://tinyurl.com/3lckz">http://tinyurl.com/3lckz</a> <span class="anchor" id="line-236"></span></li><li><p class="line891"><a class="http" href="http://tinyurl.com/5dock">http://tinyurl.com/5dock</a> <span class="anchor" id="line-237"></span></li><li><p class="line891"><a class="http" href="http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit">http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit</a> <span class="anchor" id="line-238"></span><span class="anchor" id="line-239"></span></li></ul><p class="line867">
<h2 id="Useful_Comments">Useful Comments</h2>
<span class="anchor" id="line-240"></span><span class="anchor" id="line-241"></span><p class="line867"><span class="anchor" id="line-242"></span><span class="anchor" id="line-243"></span><span class="anchor" id="line-244"></span><span class="anchor" id="line-245"></span><span class="anchor" id="line-246"></span><span class="anchor" id="line-247"></span><span class="anchor" id="line-248"></span><span class="anchor" id="line-249"></span><span class="anchor" id="line-250"></span><span class="anchor" id="line-251"></span><span class="anchor" id="line-252"></span><span class="anchor" id="line-253"></span><span class="anchor" id="line-254"></span><span class="anchor" id="line-255"></span><span class="anchor" id="line-256"></span><span class="anchor" id="line-257"></span><span class="anchor" id="line-258"></span><span class="anchor" id="line-259"></span><span class="anchor" id="line-260"></span><span class="anchor" id="line-261"></span><span class="anchor" id="line-262"></span><span class="anchor" id="line-263"></span><span class="anchor" id="line-264"></span><span class="anchor" id="line-265"></span><span class="anchor" id="line-266"></span><span class="anchor" id="line-267"></span><span class="anchor" id="line-268"></span><span class="anchor" id="line-269"></span><span class="anchor" id="line-270"></span><span class="anchor" id="line-271"></span><span class="anchor" id="line-272"></span><span class="anchor" id="line-273"></span><span class="anchor" id="line-274"></span><span class="anchor" id="line-275"></span><span class="anchor" id="line-276"></span><span class="anchor" id="line-277"></span><span class="anchor" id="line-278"></span><span class="anchor" id="line-279"></span><span class="anchor" id="line-280"></span><span class="anchor" id="line-281"></span><span class="anchor" id="line-282"></span><span class="anchor" id="line-283"></span><span class="anchor" id="line-284"></span><span class="anchor" id="line-285"></span><span class="anchor" id="line-286"></span><span class="anchor" id="line-287"></span><span class="anchor" id="line-288"></span><span class="anchor" id="line-289"></span><span class="anchor" id="line-290"></span><span class="anchor" id="line-291"></span><span class="anchor" id="line-292"></span><span class="anchor" id="line-293"></span><span class="anchor" id="line-294"></span><span class="anchor" id="line-295"></span><span class="anchor" id="line-296"></span><span class="anchor" id="line-297"></span><span class="anchor" id="line-298"></span><span class="anchor" id="line-299"></span><span class="anchor" id="line-300"></span><span class="anchor" id="line-301"></span><span class="anchor" id="line-302"></span><span class="anchor" id="line-303"></span><span class="anchor" id="line-304"></span><span class="anchor" id="line-305"></span><span class="anchor" id="line-306"></span><pre><span class="anchor" id="line-1-13"></span>From EduardoSilva Sun Dec 5 19:28:02 +0000 2004
<span class="anchor" id="line-2-8"></span>From: Eduardo Silva
<span class="anchor" id="line-3-5"></span>Date: Sun, 05 Dec 2004 19:28:02 +0000
<span class="anchor" id="line-4-5"></span>Subject: Instead of removing the rc*.d links, move them
<span class="anchor" id="line-5-2"></span>Message-ID: &lt;20041205192802+0000@https://www.ubuntulinux.org&gt;
<span class="anchor" id="line-6-2"></span>
<span class="anchor" id="line-7-2"></span>Instead of removing, I create a directory in my home dir, where I placed all the links I removed from the /etc/rc*.d
<span class="anchor" id="line-8-1"></span>
<span class="anchor" id="line-9-1"></span>From GyorgyNemeth Sun Dec 26 13:39:38 +0000 2004
<span class="anchor" id="line-10-1"></span>From: Gyorgy Nemeth
<span class="anchor" id="line-11-1"></span>Date: Sun, 26 Dec 2004 13:39:38 +0000
<span class="anchor" id="line-12-1"></span>Subject: Instead of removing, renaming
<span class="anchor" id="line-13-1"></span>Message-ID: &lt;20041226133938+0000@https://www.ubuntulinux.org&gt;
<span class="anchor" id="line-14-1"></span>
<span class="anchor" id="line-15-1"></span>If I want to disable initscript temporarily, I simply rename it from Sxxname to sxxname (without capital) It doesn't start, and the starting order information remains
<span class="anchor" id="line-16-1"></span>
<span class="anchor" id="line-17-1"></span>From FabioMarzocca Sun Apr 17 16:32:45 +0100 2005
<span class="anchor" id="line-18-1"></span>From: Fabio Marzocca
<span class="anchor" id="line-19-1"></span>Date: Sun, 17 Apr 2005 16:32:45 +0100
<span class="anchor" id="line-20-1"></span>Subject:
<span class="anchor" id="line-21-1"></span>Message-ID: &lt;20050417163245+0100@https://www.ubuntulinux.org&gt;
<span class="anchor" id="line-22-1"></span>
<span class="anchor" id="line-23-1"></span>Why don't simply use rcconf?? (apt-get install rcconf)
<span class="anchor" id="line-24-1"></span>
<span class="anchor" id="line-25-1"></span>From Chia Thu Apr 21 03:41:09 +0100 2005
<span class="anchor" id="line-26-1"></span>From: Chia
<span class="anchor" id="line-27-1"></span>Date: Thu, 21 Apr 2005 03:41:09 +0100
<span class="anchor" id="line-28-1"></span>Subject:
<span class="anchor" id="line-29-1"></span>Message-ID: &lt;20050421034109+0100@www.ubuntulinux.org&gt;
<span class="anchor" id="line-30-1"></span>
<span class="anchor" id="line-31"></span>Try sysv-rc-conf (text based) or ksysv (KDE based). sudo apt-get install sysv-rc-conf
<span class="anchor" id="line-32"></span>
<span class="anchor" id="line-33"></span>Try sysvconfig as well - it's also quite handy.
<span class="anchor" id="line-34"></span>
<span class="anchor" id="line-35"></span>From JoostRingoot Fri May 6 10:33:57 +0100 2005
<span class="anchor" id="line-36"></span>From: Joost Ringoot
<span class="anchor" id="line-37"></span>Date: Fri, 06 May 2005 10:33:57 +0100
<span class="anchor" id="line-38"></span>Subject: runlevel with networking and without graphical interface?
<span class="anchor" id="line-39"></span>Message-ID: &lt;20050506103357+0100@www.ubuntulinux.org&gt;
<span class="anchor" id="line-40"></span>
<span class="anchor" id="line-41"></span>I would like to have a runlevel with basic networksupport (and services like ssh and sftp) but without the graphical interface. This is not implemented in
<span class="anchor" id="line-42"></span>/etc/init.d/rcS
<span class="anchor" id="line-43"></span>
<span class="anchor" id="line-44"></span>When I run:
<span class="anchor" id="line-45"></span>apt-get install rcconf
<span class="anchor" id="line-46"></span>
<span class="anchor" id="line-47"></span>I get the message that rcconf package could not be found.
<span class="anchor" id="line-48"></span>
<span class="anchor" id="line-49"></span>apt-get install sysv-rc-conf
<span class="anchor" id="line-50"></span>
<span class="anchor" id="line-51"></span>tells me that the package is not available although another package points to it
<span class="anchor" id="line-52"></span>
<span class="anchor" id="line-53"></span>I would like to put this runlevel in the (grub) bootmenu, so that I can choose it at boot and not need to chmod files.
<span class="anchor" id="line-54"></span>
<span class="anchor" id="line-55"></span>suggestions are welcome.
<span class="anchor" id="line-56"></span>
<span class="anchor" id="line-57"></span>From Chia Sat May 7 06:46:56 +0100 2005
<span class="anchor" id="line-58"></span>From: Chia
<span class="anchor" id="line-59"></span>Date: Sat, 07 May 2005 06:46:56 +0100
<span class="anchor" id="line-60"></span>Subject:
<span class="anchor" id="line-61"></span>Message-ID: &lt;20050507064656+0100@https://www.ubuntulinux.org&gt;
<span class="anchor" id="line-62"></span>
<span class="anchor" id="line-63"></span>To apt-get sysv-rc-conf, you need to enable universe in /etc/apt/sources.list ,for easy way to do it use synaptic -&gt; settings -&gt; repositories, or read the unofficial ubuntu starter guide at http://www.ubuntuguide.org/
<span class="anchor" id="line-64"></span>. Also worth trying Boot-Up Manager: http://www.marzocca.net/linux/bum.html</pre><span class="anchor" id="line-307"></span><span class="anchor" id="bottom"></span></div><p id="pageinfo" class="info" lang="en" dir="ltr">UbuntuBootupHowto  (last edited 2011-08-18 09:16:47 by <span title="https://login.launchpad.net/+id/4RwM4Er @ cpe-76-176-210-75.san.res.rr.com[76.176.210.75]"><a class="interwiki" href="https://launchpad.net/~kralph" title="https://login.launchpad.net/+id/4RwM4Er @ cpe-76-176-210-75.san.res.rr.com[76.176.210.75]">kralph</a></span>)</p>

<ul class="pagelinks">
<li><a class="nbinfo" href="/community/UbuntuBootupHowto?action=info" rel="nofollow">Page History</a></li>
</ul>

<div id="pagebottom"></div>
</div>


<div id="footer">
<hr width="550px">

  <div id="ubuntulinks">
	<p>
	      The material on this wiki is available under a free license, see <a href="https://help.ubuntu.com/community/License">Copyright / License</a> for details<br /><b>You</b> can contribute to this wiki, see <a href="https://help.ubuntu.com/community/WikiGuide">Wiki Guide</a> for details
	</p><br>
  </div>
<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1018242-7";
urchinTracker();
__utmSetVar('UbuntuWiki');
</script>
<script type="text/javascript">
function togglebar() {
    obj = document.getElementById('editbar');
    obj2 = document.getElementById('showbarspan');
    obj3 = document.getElementById('showbar');
    if (obj.style.position == 'fixed') {
        obj.style.position = 'static';
	obj3.style.bottom = '0';
        obj2.innerHTML = 'Show';
    } else {
        obj.style.position = 'fixed';
        obj2.innerHTML = 'Hide';
        obj3.style.bottom = '25px';
    }
    return false;
}
</script>


</div> <!-- footer -->
</div> <!-- layout -->
<img id="bottomcap" alt="" src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-bottom.png">
</div> <!-- round -->
</body>
</html>

